package org.jash.shop2112.utils

import org.jash.shop2112.entity.BannerEntity
import org.jash.shop2112.entity.Cart
import org.jash.shop2112.entity.CartItem
import org.jash.shop2112.entity.Category
import org.jash.shop2112.entity.Goods
import org.jash.shop2112.entity.Res
import org.jash.shop2112.entity.User
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface APIService {
    @POST("/user/loginjson")
    suspend fun login(@Body map: org.jash.shop2112.user.User):Res<User>
    @POST("/user/register")
    suspend fun register(@Body map: Map<String, String>):Res<User>
    @GET("/banner/json")
    suspend fun getBanner():Res<List<BannerEntity>>
    @GET("/goods/info")
    suspend fun getGoods(@Query("category_id")cid:Int, @Query("currentPage")currentPage:Int, @Query("pageSize")pageSize:Int):Res<List<Goods>>
    @GET("/goods/detail")
    suspend fun getGoodsDetail(@Query("goods_id") id:Int):Res<Goods>
    @POST("/goods/addCar")
    suspend fun addCart(@Body map:Map<String, String>):Res<Any?>
    @GET("/goods/category")
    suspend fun getCategory():Res<List<Category>>
    @GET("/goods/selectCar")
    suspend fun getCarts():Res<List<CartItem>>
    @POST("/goods/deleteCar")
    suspend fun deleteCart(@Body map:Map<String,String>):Res<Any?>
}